package com.automobile.backstage.controller;

import com.automobile.backstage.domain.Mail;
import com.automobile.backstage.mail.MailUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 类的作用
 *
 * @author liujiamiao
 * @email 2544296058@qq.com
 * @date 2020-03-14 22:39
 */
@Controller
@RequestMapping("/mail")
public class MailController {

    @RequestMapping("/send")
    public @ResponseBody int send(@RequestBody Mail mail){
        System.out.println(mail);
        MailUtils.send(mail.getAddress(),mail.getTitle(),mail.getMessage());
        return 1;
    }

}
